#ifndef H_C_CALL_RPC_RET_H
#define H_C_CALL_RPC_RET_H

#include "../typedefine.h"
#include "EProtocolErrorCode.h"

namespace QWER
{
	QCLASS IRpcArg;
	QCLASS IRpcRet;

    QTEMPLATE<typename T_ARG, typename T_RET> QWHERE(T_RET:IRpcRet, T_ARG:IRpcArg)
	QDLL_EXPORT QSTRUCT SCallRpcRet
	{
	public:
		SCallRpcRet(){}
		SCallRpcRet(EProtocolErrorCode eErrorCode, QMOVEABLE(T_ARG) poArg, QMOVEABLE(T_RET) poRet)
		{
			m_eErrorCode = eErrorCode;
			m_poArg = QMOVE(poArg);
			m_poRet = QMOVE(poRet);
		}
	public:
		EProtocolErrorCode m_eErrorCode = EProtocolErrorCode::Success;
		CUniquePtr(T_ARG) m_poArg;
		CUniquePtr(T_RET) m_poRet;
	};

	template<typename T_ARG, typename T_RET>
	SCallRpcRet<T_ARG, T_RET> MakeCallRpcRet(EProtocolErrorCode eErrorCode, QMOVEABLE(T_ARG) poArg)
	{
		return std::move(SCallRpcRet<T_ARG, T_RET>(eErrorCode, std::move(poArg), NULL_PTR));
	}

	template<typename T_ARG, typename T_RET>
	SCallRpcRet<T_ARG, T_RET> MakeCallRpcRet(QMOVEABLE(T_ARG) poArg, QMOVEABLE(T_RET) poRet)
	{
		return std::move(CCallRpcRet<T_ARG, T_RET>(EProtocolErrorCode::Success, std::move(poArg), std::move(poRet)));
	}
}

#endif
